<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }

        ul,
        li {
            list-style: none;
        }

        li {
            width: 600px;
            height: 200px;
            border: 1px solid grey;
            line-height: 200px;
            text-align: center;
            margin: 50px;

            position: relative;
        }

        p {
            width: 600px;
            height: 200px;
            display: none;


            position: absolute;
            top: 0px;
            left: 800px;
        }
    </style>
</head>

<body>
    <ul>
        <li>
            海阔天空
            <p style="background-color: pink;">今天我,黑夜里看着雪飘过....</p>
        </li>
        <li>
            东风破
            <p style="background-color: skyblue;">谁在用琵琶弹奏一区东风破.....</p>
        </li>
        <li>
            天路
            <p style="background-color: yellow;">那是一条神奇的天路.....</p>
        </li>
    </ul>
    <script>
        /* 
            盒子跟随鼠标移动
                1. 获取li
                2. 在li当中有一个鼠标移入与移出事件
                    移入就显示对应的p标签
                    移出就隐藏对应的p标签
        */
        var lis = document.querySelectorAll("li")
        for (var i = 0; i < lis.length; i++) {
            //鼠标移入事件,显示p标签
            lis[i].onmouseover = function () {
                // console.log(this.firstElementChild);
                this.firstElementChild.style.display = "block"
            }
            //鼠标移出事件,隐藏p标签
            lis[i].onmouseout = function () {
                this.firstElementChild.style.display = "none"
            }
        }
    </script>
</body>

</html>